#ifndef UCOMBOBOX
#define UCOMBOBOX
#include "../stdafx.h"
#include "UControl.h"

class TComboBox: public TControl
{
private:
	TEdit* Edit;
	bool DroppedDown;
	std::vector<std::string>Items;
	int MaxTextWidth;
	int TotalStrHeight;
	int MouseIndex(int X, int Y);
	int RealBottom; //bottom when created
public:
	TComboBox(TRectangle rect);	
	std::string GetText();
	void SetText(string Text);
	
	virtual void Draw();
	virtual void MouseDown	(int X, int Y, uint8 button);
	virtual void MouseUp	(int X, int Y, uint8 button);
	virtual void MouseMove	(int X, int Y, int mstate);
	virtual void KeyDown	(SDL_KeyboardEvent* Key);
	
	virtual void setFocus(bool focus);
	void AddItem(std::string Item);

	void OnEditChange();
	function<void()> onChange;
};

#endif
